# FROM base/alpine:3.21
FROM registry.chentaihealth.cn/base/alpine:3.21

RUN apk add --no-cache -t .deps \
    go && \
    \
    go env -w "GOPROXY=https://mirrors.aliyun.com/goproxy/,https://goproxy.cn,https://goproxy.io,direct" && \
    \
    mkdir -p /usr/local/src && \
    cd /usr/local/src && \
    git clone https://gitee.com/go-libs/kv.git && \
    cd kv && \
    go mod tidy && \
    go build -o /usr/local/bin/kv && \
    chmod +x /usr/local/bin/kv && \
    cd /data && \
    \
    apk del .deps && \
    rm -rf /usr/local/src && \
    rm -rf /root/go && \
    rm -rf /root/.cache && \
    rm -rf /root/.config/go
